﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartPowerHub.Communication
{
    public delegate void DisconnectEvent(object? sender);

    public delegate void ConnectEvent(object? sender);

    public interface ICommunication
    {
        /// <summary>
        /// 连接状态
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// 连接
        /// </summary>
        Task ConnectAsync();

        /// <summary>
        /// 断开
        /// </summary>
        Task DisconnectAsync();

        /// <summary>
        /// 断开事件
        /// </summary>
        event DisconnectEvent DisconnectEvent;

        /// <summary>
        /// 连接事件
        /// </summary>
        event ConnectEvent ConnectEvent;
    }
}
